package com.anlogic.sdk.utils;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.core.LoggerContext;

public class LogUtils {
	private static Logger logger = LogManager.getLogger(LogUtils.class);

	public static Logger getLogger() {
		return logger;
	}

	public static Logger getLogger(Class<?> clazz) {
		return LogManager.getLogger(clazz);
	}

	public static void setLevel(String level) {
		LoggerContext context = (LoggerContext) LogManager.getContext(false);
		Logger logToIDE = context.getLogger("LogToIDEConsole");
		Configurator.setLevel(logToIDE.getName(), Level.toLevel(level));
	}
	
	public static Level getLevel(String level) {
		return Level.toLevel(level);
	}
}
